﻿using LeoK.Common;
using LeoK.Common.Converter;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LeoK.TM.Entity
{
    public class TM_Sln : EntityBase
    {
        private int _id;
        private DateTime _updateTime;
        private double _cost;

        [EBAttribute(IsReadOnly = true)]
        [DisplayAttribute(Name = "ID")]
        public int ID
        {
            get { return _id; }
            set
            {
                _id = value; 
                OnPropertyChanged();
            }
        }

        [DisplayAttribute(Name = "项目名称")]
        public string Name { get; set; }

        [EBAttribute(AllowFilter = true)]
        [DisplayAttribute(Name = "类型")]
        public SlnType Type { get; set; }

        [DisplayAttribute(Name = "创建时间")]
        public DateTime StartTime { get; set; }

        [EBAttribute(IsReadOnly = true)]
        [DisplayAttribute(Name = "更新时间")]
        public DateTime UpdateTime
        {
            get { return _updateTime; }
            set
            {
                _updateTime = value; 
                OnPropertyChanged();
            }
        }
        
        [EBAttribute(IsReadOnly = true, DataConverter = typeof(MinutesToStringConverter))]
        [DisplayAttribute(Name = "耗时")]
        public int TimeSpend { get; set; }

        [EBAttribute(IsReadOnly = true)]
        [DisplayAttribute(Name = "成本")]
        public double Cost
        {
            get { return _cost; }
            set
            {
                _cost = value; 
                OnPropertyChanged();
            }
        }

        [DisplayAttribute(Name = "状态")]
        public SlnStatus Status { get; set; }

        [DisplayAttribute(Name = "备注")]
        public string Note { get; set; }

        [DisplayAttribute(Name = "颜色标记")]
        public string ColorFlag { get; set; }

        public TM_Sln()
        {
            StartTime = DateTime.Now;
            UpdateTime = DateTime.Now;
        }
    }

    public enum SlnType
    {
        日常事务 = 0,
        工作 = 1,
        LeoK项目 = 2
    }

    public enum SlnStatus
    {
        立项 = 0,
        进行中 = 1,
        维护 = 2,
        结束 = 3,
        放弃 = 4
    }
}
